package com.mzm.config;

import javax.annotation.Resource;

/**
 * 
 * @author daniel
 *
 */
public class ConfigurationFacadeImpl implements ConfigurationFacade {

	@Resource
	private ConfigurationService configurationService;

	public void setConfigurationService(ConfigurationService configurationService) {
		this.configurationService = configurationService;
	}

	@Override
	public String getParameter(String section, String paramName) {
		Parameter p = configurationService.getParameter(section, paramName);
		if(p == null)
			return null;
		return p.getStringValue();
	}

	@Override
	public Object getObjectParameter(String section, String paramName) {
		Parameter p = configurationService.getParameter(section, paramName);
		if(p == null)
			return null;
		return p.getObjectValue();
	}

	@Override
	public void setParameter(String section, String paramName, String value) {
		configurationService.setParameter(section, paramName, value);
	}

	@Override
	public void setParameter(String section, String paramName, Object value) {
		configurationService.setParameter(section, paramName, value);
	}

	@Override
	public String getDbVersion() {
		return configurationService.getDbVersion();
	}

	@Override
	public void setChartConfig(ChartConfig cc) {
		configurationService.setParameter("Charts", cc.getChartId(), cc);
	}

}
